home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / os2 / octa209s.zip / octave-2.09 / src / ov-colon.h < prev    next >
C/C++ Source or Header  |  1996-11-07  |  2KB  |  98 lines

  1. /*
  2.  
  3. Copyright (C) 1996 John W. Eaton
  4.  
  5. This file is part of Octave.
  6.  
  7. Octave is free software; you can redistribute it and/or modify it
  8. under the terms of the GNU General Public License as published by the
  9. Free Software Foundation; either version 2, or (at your option) any
  10. later version.
  11.  
  12. Octave is distributed in the hope that it will be useful, but WITHOUT
  13. ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  14. FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  15. for more details.
  16.  
  17. You should have received a copy of the GNU General Public License
  18. along with Octave; see the file COPYING.  If not, write to the Free
  19. Software Foundation, 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  20.  
  21. */
  22.  
  23. #if !defined (octave_magic_colon_h)
  24. #define octave_magic_colon_h 1
  25.  
  26. #include <cstdlib>
  27.  
  28. #include <string>
  29.  
  30. class ostream;
  31.  
  32. #include "mx-base.h"
  33. #include "str-vec.h"
  34.  
  35. #include "error.h"
  36. #include "ov-base.h"
  37. #include "ov-typeinfo.h"
  38.  
  39. class Octave_map;
  40. class octave_value_list;
  41.  
  42. class tree_walker;
  43.  
  44. // A type to represent `:' as used for indexing.
  45.  
  46. class
  47. octave_magic_colon : public octave_base_value
  48. {
  49. public:
  50.  
  51.   octave_magic_colon (void)
  52.     : octave_base_value () { }
  53.  
  54.   octave_magic_colon (const octave_magic_colon&)
  55.     : octave_base_value () { }
  56.  
  57.   ~octave_magic_colon (void) { }
  58.  
  59.   octave_value *clone (void) { return new octave_magic_colon (*this); }
  60.  
  61.   idx_vector index_vector (void) const { return idx_vector (':'); }
  62.  
  63.   bool is_defined (void) const { return true; }
  64.  
  65.   bool is_magic_colon (void) const { return true; }
  66.  
  67.   bool valid_as_scalar_index (void) const { return true; }
  68.  
  69.   bool valid_as_zero_index (void) const { return false; }
  70.  
  71.   void print (ostream& os, bool pr_as_read_syntax = false);
  72.  
  73.   int type_id (void) const { return t_id; }
  74.  
  75.   string type_name (void) const { return t_name; }
  76.  
  77.   static int static_type_id (void) { return t_id; }
  78.  
  79.   static void register_type (void)
  80.     { t_id = octave_value_typeinfo::register_type (t_name); }
  81.  
  82. private:
  83.  
  84.   // Type id of magic colon objects, set by register_type().
  85.   static int t_id;
  86.  
  87.   // Type name of magic colon objects, defined in ov-colon.cc.
  88.   static const string t_name;
  89. };
  90.  
  91. #endif
  92.  
  93. /*
  94. ;;; Local Variables: ***
  95. ;;; mode: C++ ***
  96. ;;; End: ***
  97. */
  98.